home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7357 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.sources.wanted
  4. Subject: Re: regular expression matching source code
  5. Date: 22 Feb 1996 11:23:52 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Distribution: na
  8. Message-ID: <4gifs8INN67e@keats.ugrad.cs.ubc.ca>
  9. References: <DMwHzn.LIF@bcstec.ca.boeing.com>
  10. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  11.  
  12. In article <DMwHzn.LIF@bcstec.ca.boeing.com>,
  13. Todd Waetzig <waetzig@bcstec.ca.boeing.com> wrote:
  14. >I am looking for the 'C' or 'C++' source for a function to
  15. >perform a match of a string. This function would
  16. >use the syntax of regular expressions. This regular
  17. >expression matching would be similar to that used by
  18. >grep and sed.
  19. >
  20. >Ideally it would look something like
  21. >
  22. >if (match("^1([A-Z]*|[0-9]*)Z?",string_to_search) == 0)
  23. >    printf("match found ");
  24.  
  25. That would be far from ideal, unless the match() function was able to keep a
  26. cache of recently used regular expressions to avoid recompiling the above on
  27. each invocation.
  28.  
  29. Regexp matching really requires an interface that separates the expression
  30. compiler from the finite state machine emulator which executes the match.
  31.  
  32. Try the regular expression source code in the GNU C library. The freeware UNIX
  33. variants have to get their regex routines from somwhere!
  34.  
  35. Chances are, any time you need C code that  is normally found in a UNIX
  36. library, you can find it as freeware code that is part of Linux, FreeBSD et al.
  37. -- 
  38.  
  39.